﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using LPY.LeHealth.DTO;

namespace LPY.LeHealth.DAL
{
    using ServiceStack.OrmLite;
    public class PersonalizedDAL : BaseDAL
    {

        /// <summary>
        /// 添加单项体检产品
        /// </summary>
        /// <param name="hospital">单项体检信息</param>
        /// <returns>是否添加成功</returns>
        public bool Add(Personalized_ExaminationDTO personalized)
        {
            var rtv = DbConnection.Insert<Personalized_ExaminationDTO>(personalized);
            return rtv > 0;
        }


        /// <summary>
        /// 根据医院id获取单项体检产品
        /// </summary>
        /// <returns></returns>
        public  List<Personalized_ExaminationDTO> GetList(int id)
        {
            var sqlExpression = DbConnection.From<Personalized_ExaminationDTO>().Where(C => C.HospitalId==id);
            var rtv = DbConnection.Select(sqlExpression).ToList();
            return rtv;

        }
        /// <summary>
        ///单项体检显示
        /// </summary>
        /// <returns></returns>
        public List<Personalized_ExaminationDTO> GetPersonalized_ExaminationDTO()
        {
            var sqlExpression = DbConnection.From<Personalized_ExaminationDTO>();
            var rtv = DbConnection.Select(sqlExpression).ToList();
            return rtv;
        }

    }
}
